/*
 *  Copyright 2007-2008 by Matthias Buch-Kromann <mbk.isv@cbs.dk>.
 *  *
 *  This file is part of the Open-source Dependency Toolkit (OSDT),
 *  see http://code.google.com/p/open-source-dependency-toolkit.
 *  
 *  The OSDT is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as 
 *  published by the Free Software Foundation, either version 3 of 
 *  the License, or (at your option) any later version.
 * 
 *  The OSDT is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 * 
 *  You should have received a copy of the GNU Lesser General Public 
 *  License along with the OSDT in the files COPYING and COPYING.LESSER.
 *  If not, see http://www.gnu.org/licenses.
 */

package org.osdtsystem.estimators;

import org.osdtsystem.utils.Storage;
import org.osdtsystem.values.Augmentation;
import java.util.List;

/**
 * The public interface for an estimator which can compute a cost for any 
 * observation given a set of parameters, and estimate a set of parameters
 * from a set of observations. An observation is encoded as an augmentation.
 * @param <P> the class for the trained parameters
 * @author Matthias Buch-Kromann <mbk.isv@cbs.dk>
 */
public interface Estimator<P extends Parameters> {
    /**
     * Train the estimator on a given training data set (batch training). 
     * @param observations the observations in the training data
     * @param storageFactory a storage factory that is used to allocate storage 
     * for the estimator
     * @return the parameters that are produced as a result of the training
     */
    public P train(List<Augmentation> observations, Storage storageFactory);
    
    
    /**
     * Compute the score that the estimator assigns to an observation given a
     * set of parameters.
     * @param observation the observation (encoded as an augmentation)
     * @param parameters the set of parameters for the estimated function
     * @return the score that the estimated function assigns to the observation
     */
    public double evaluate(P parameters, Augmentation observation);

    /**
     * Cleanup the training data by deleting all training data and keeping 
     * only the trained parameters. 
     */
    public void cleanup();
}
